package com.lebang.mapper;

import com.lebang.configuration.datasource.DataSource;
import com.lebang.domain.CencesApru;
import com.lebang.example.CencesApruExample;
import com.lebang.model.cences.MemberNewTradeCount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;

/**
 * CencesApruMapper继承基类
 */
@Mapper
public interface CencesApruMapper extends MyBatisBaseDao<CencesApru, Integer, CencesApruExample> {

    List<CencesApru> selectBrandCount(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    int selectXzsbs(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("brand") String brand);

    BigDecimal selectZffe(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("brand") String brand);

    List<CencesApru> selectListGroupByTime(@Param("page") Long page, @Param("limit") Integer limit, @Param("star") Integer star, @Param("end") Integer end);

    BigDecimal selectXffe(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("brand") String brand);

    int selectXffrs(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("brand") String brand);

    Set<String> selectZffrs(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("brand") String brand);

    @DataSource("commonDB")
    CencesApru selectByAll(@Param("star") Integer star, @Param("end") Integer end, @Param("type") int type, @Param("brand") String brand, @Param("appId") Integer appId);

    List<MemberNewTradeCount> selectImeiByDate(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    @DataSource("commonDB")
    int insertApru(CencesApru s);

    @DataSource("commonDB")
    void deleteByAppIdAndTime(@Param("appId") Integer appId,@Param("time") int time);
}